<html>
<head><meta charset="utf-8"><title>backtrace hooks in core · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html">backtrace hooks in core</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223314685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314685">(Jan 20 2021 at 00:07)</a>:</h4>
<p>hello, the error handling project could use some help from the compiler team to figure out how best to implement our backtrace in core proof of concept as part of stabilizing backtrace</p>



<a name="223314724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314724">(Jan 20 2021 at 00:07)</a>:</h4>
<p>relevant thread: <a href="#narrow/stream/257204-project-error-handling/topic/backtrace.20stabilization">https://rust-lang.zulipchat.com/#narrow/stream/257204-project-error-handling/topic/backtrace.20stabilization</a><br>
relevant draft PR: <a href="https://github.com/rust-lang/rust/pull/77384">https://github.com/rust-lang/rust/pull/77384</a></p>



<a name="223314796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314796">(Jan 20 2021 at 00:08)</a>:</h4>
<p>the issue at hand is that we need to add a hook vaguely similar to <code>#[panic_handler]</code></p>



<a name="223314799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314799">(Jan 20 2021 at 00:08)</a>:</h4>
<p>or maybe more than one hook</p>



<a name="223314819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314819">(Jan 20 2021 at 00:08)</a>:</h4>
<p>which provides the functionality for a <code>core::backtrace::Backtrace</code> type</p>



<a name="223314831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314831">(Jan 20 2021 at 00:08)</a>:</h4>
<p>and which is provided by <code>std</code></p>



<a name="223314843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314843">(Jan 20 2021 at 00:08)</a>:</h4>
<p>the rub being I think we need to also provide an implementation by default when <code>std</code> isn't linked in</p>



<a name="223314874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223314874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223314874">(Jan 20 2021 at 00:09)</a>:</h4>
<p>which I don't think <code>#[panic_handler]</code> or any of the similar hooks do</p>



<a name="223317315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317315">(Jan 20 2021 at 00:40)</a>:</h4>
<blockquote>
<p>Jane Lusby: my impression is that the type of hooks that we want currently don't have any prior art<br>
Jane Lusby: and we'd need to add some new support in the compiler</p>
</blockquote>
<p>can you expand on why these hooks are different?</p>



<a name="223317337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317337">(Jan 20 2021 at 00:40)</a>:</h4>
<p>and what are the hooks actually doing? could you use something like <code>set_panic_hook</code> that works at runtime?</p>



<a name="223317495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317495">(Jan 20 2021 at 00:42)</a>:</h4>
<p>also only vaguely related, but I've been thinking for a while about a <code>global_resource</code> attribute, instead of special casing all these things in the compiler</p>



<a name="223317527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317527">(Jan 20 2021 at 00:43)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="219805">@devsnek</span> was the one telling me how he had to go through like 30 different places to make <code>no_mangle</code> unconditionally link into the binary</p>



<a name="223317555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317555">(Jan 20 2021 at 00:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223317495">said</a>:</p>
<blockquote>
<p>also only vaguely related, but I've been thinking for a while about a <code>global_resource</code> attribute, instead of special casing all these things in the compiler</p>
</blockquote>
<p>I think a lot of this boils down to existential traits</p>



<a name="223317612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317612">(Jan 20 2021 at 00:44)</a>:</h4>
<p>hmm? how are traits related?</p>



<a name="223317626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317626">(Jan 20 2021 at 00:44)</a>:</h4>
<p>where we'd want to have a trait for like "BacktraceImplementation" and declare that there exists one implementor of that trait somewhere in the crate graph, and define that extern trait in core then impl it in std</p>



<a name="223317643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317643">(Jan 20 2021 at 00:44)</a>:</h4>
<p>ah ok, you mean it in a different sense than the compiler uses it</p>



<a name="223317648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317648">(Jan 20 2021 at 00:45)</a>:</h4>
<p>yea</p>



<a name="223317654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317654">(Jan 20 2021 at 00:45)</a>:</h4>
<p>theres an RFC somewhere</p>



<a name="223317660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317660">(Jan 20 2021 at 00:45)</a>:</h4>
<p>you want like a "global implementor"</p>



<a name="223317662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317662">(Jan 20 2021 at 00:45)</a>:</h4>
<p>that someone brought up last time I talked about these hooks</p>



<a name="223317663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317663">(Jan 20 2021 at 00:45)</a>:</h4>
<p>yea</p>



<a name="223317670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317670">(Jan 20 2021 at 00:45)</a>:</h4>
<p>which is what I took you to mean by global_resource</p>



<a name="223317679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317679">(Jan 20 2021 at 00:45)</a>:</h4>
<p>i think they're both approaching the same idea</p>



<a name="223317686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317686">(Jan 20 2021 at 00:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223317495">said</a>:</p>
<blockquote>
<p>also only vaguely related, but I've been thinking for a while about a <code>global_resource</code> attribute, instead of special casing all these things in the compiler</p>
</blockquote>
<p>this would be pretty cool. i think both rust users and rust devs would find it clearer :)</p>



<a name="223317703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317703">(Jan 20 2021 at 00:46)</a>:</h4>
<p>I have no idea how it would actually work, but it would be nice to generalize this</p>



<a name="223317756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317756">(Jan 20 2021 at 00:46)</a>:</h4>
<p>that would also let users use it too - imagine if you had <code>#[global_resource(async_executor = "tokio")]</code> or something</p>



<a name="223317772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317772">(Jan 20 2021 at 00:46)</a>:</h4>
<p>i was just about to say, you could tell rust to use a specific async executor</p>



<a name="223317782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317782">(Jan 20 2021 at 00:47)</a>:</h4>
<p>as long as there's some <code>Executor</code> interface you can suddenly abstract over executors in libraries</p>



<a name="223317783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317783">(Jan 20 2021 at 00:47)</a>:</h4>
<p><a href="#narrow/stream/213817-t-lang/topic/global.20hooks.20and.20their.20relation.20to.20traits.20and.20vtables">https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/global.20hooks.20and.20their.20relation.20to.20traits.20and.20vtables</a></p>



<a name="223317815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317815">(Jan 20 2021 at 00:47)</a>:</h4>
<p>here's the RFC</p>



<a name="223317816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317816">(Jan 20 2021 at 00:47)</a>:</h4>
<p><a href="https://github.com/rust-lang/rfcs/pull/2492">https://github.com/rust-lang/rfcs/pull/2492</a></p>



<a name="223317826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317826">(Jan 20 2021 at 00:47)</a>:</h4>
<p>but I don't want to block this proof of concept on that RFC</p>



<a name="223317892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317892">(Jan 20 2021 at 00:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223317826">said</a>:</p>
<blockquote>
<p>but I don't want to block this proof of concept on that RFC</p>
</blockquote>
<p>yeah, it would just be nice to have</p>



<a name="223317895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317895">(Jan 20 2021 at 00:48)</a>:</h4>
<p>for sure</p>



<a name="223317934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317934">(Jan 20 2021 at 00:49)</a>:</h4>
<p>that rfc looks very cool as well</p>



<a name="223317977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317977">(Jan 20 2021 at 00:49)</a>:</h4>
<p>so the question is, how would we do this now for a <code>std::core::Backtrace</code> type</p>



<a name="223317992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317992">(Jan 20 2021 at 00:49)</a>:</h4>
<p>and I think there's one design question we might want to answer first</p>



<a name="223317993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223317993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223317993">(Jan 20 2021 at 00:49)</a>:</h4>
<p>which is</p>



<a name="223318049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318049">(Jan 20 2021 at 00:50)</a>:</h4>
<p>what should <code>std::core::Backtrace</code> do in no_std environments with no backtrace impl</p>



<a name="223318081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318081">(Jan 20 2021 at 00:50)</a>:</h4>
<p>should the user have to provide it themselves, similar to <code>#[panic_handler]</code> or should we provide a default impl that just always returns empty disabled backtraces</p>



<a name="223318086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318086">(Jan 20 2021 at 00:50)</a>:</h4>
<p>what do you mean by <code>std::core</code>?</p>



<a name="223318091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318091">(Jan 20 2021 at 00:50)</a>:</h4>
<p>fk</p>



<a name="223318095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318095">(Jan 20 2021 at 00:50)</a>:</h4>
<p>core::backtrace::Backtrace</p>



<a name="223318098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318098">(Jan 20 2021 at 00:50)</a>:</h4>
<p>that was a brainfart</p>



<a name="223318104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318104">(Jan 20 2021 at 00:50)</a>:</h4>
<p>np</p>



<a name="223318117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318117">(Jan 20 2021 at 00:51)</a>:</h4>
<p>getting towards the end of my workday, lol</p>



<a name="223318138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318138">(Jan 20 2021 at 00:51)</a>:</h4>
<p>my expectation is that we'd want the latter design</p>



<a name="223318168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318168">(Jan 20 2021 at 00:51)</a>:</h4>
<p>but then i go back to "how do we provide a default implementation of an extern function in the compiler automatically" or w/e that really boils down to</p>



<a name="223318283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318283">(Jan 20 2021 at 00:53)</a>:</h4>
<p>FWIW I think it would backwards compatible to start by requiring a <code>#[backtrace_generator]</code> or whatever and then add a default later</p>



<a name="223318305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318305">(Jan 20 2021 at 00:53)</a>:</h4>
<p>I guess the question is if that's <em>useful</em> or not</p>



<a name="223318595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318595">(Jan 20 2021 at 00:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223318283">said</a>:</p>
<blockquote>
<p>FWIW I think it would backwards compatible to start by requiring a <code>#[backtrace_generator]</code> or whatever and then add a default later</p>
</blockquote>
<p>I'm surprised this would be backwards compatible</p>



<a name="223318609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318609">(Jan 20 2021 at 00:57)</a>:</h4>
<p>do no_std binaries already require nightly and feature flags?</p>



<a name="223318661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318661">(Jan 20 2021 at 00:58)</a>:</h4>
<p>i would think adding this would make existing no_std code that doesn't already have <code>#[backtrace_generator]</code> stop compiling</p>



<a name="223318691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318691">(Jan 20 2021 at 00:58)</a>:</h4>
<p>no_std is stable</p>



<a name="223318702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318702">(Jan 20 2021 at 00:58)</a>:</h4>
<p>I think you need nightly to write a no_std <em>binary</em>, though</p>



<a name="223318733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318733">(Jan 20 2021 at 00:59)</a>:</h4>
<p>nop</p>



<a name="223318768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318768">(Jan 20 2021 at 00:59)</a>:</h4>
<p>also i guess it doesn't really matter if we actually implement the default hook stuff</p>



<a name="223318782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318782">(Jan 20 2021 at 01:00)</a>:</h4>
<p>since this is only a proof of concept</p>



<a name="223318817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318817">(Jan 20 2021 at 01:00)</a>:</h4>
<p>not something that will be merged</p>



<a name="223318838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318838">(Jan 20 2021 at 01:00)</a>:</h4>
<p>we just need to be sure we could later write the big PR to move the error trait to core</p>



<a name="223318864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318864">(Jan 20 2021 at 01:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223318702">said</a>:</p>
<blockquote>
<p>I think you need nightly to write a no_std <em>binary</em>, though</p>
</blockquote>
<p>yeah:</p>
<div class="codehilite"><pre><span></span><code>error: language item required, but not found: `eh_personality`
</code></pre></div>
<p>and then adding a lang_item needs nightly</p>



<a name="223318919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318919">(Jan 20 2021 at 01:01)</a>:</h4>
<p>so maybe we should just leverage lang items for onw</p>



<a name="223318937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318937">(Jan 20 2021 at 01:01)</a>:</h4>
<p>and then once we've got that working talk to the libs team about the eventual design concerns around no_std</p>



<a name="223318947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223318947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223318947">(Jan 20 2021 at 01:01)</a>:</h4>
<p>and see if they want additional research on those issues or if we're already confident we can solve them down the line</p>



<a name="223319027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223319027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223319027">(Jan 20 2021 at 01:02)</a>:</h4>
<p>that certainly makes it easier</p>



<a name="223319034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223319034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223319034">(Jan 20 2021 at 01:02)</a>:</h4>
<p>(I do not have strong opinions on any of this)</p>



<a name="223320927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223320927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223320927">(Jan 20 2021 at 01:27)</a>:</h4>
<p>now hold on there josh</p>



<a name="223320957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223320957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223320957">(Jan 20 2021 at 01:27)</a>:</h4>
<p>with panic=abort, i'm fairly sure that you can make a no_std binary, though IIRC that was never mentioned in any release info</p>



<a name="223321089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321089">(Jan 20 2021 at 01:29)</a>:</h4>
<p>oh hmm good point</p>



<a name="223321098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321098">(Jan 20 2021 at 01:29)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> so maybe this wouldn't be backwards compatible</p>



<a name="223321256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321256">(Jan 20 2021 at 01:31)</a>:</h4>
<p>Confirmed. I pulled up an old project, you can use Stable to make a <code>no_std</code> binary.</p>
<p>But you need Nightly to unwind or to alloc</p>



<a name="223321576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321576">(Jan 20 2021 at 01:35)</a>:</h4>
<p>yup, stable no_std binaries work even on hosted platforms :)</p>



<a name="223321586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321586">(Jan 20 2021 at 01:35)</a>:</h4>
<p>you have to use <code>#![no_main]</code> too I think</p>



<a name="223321593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321593">(Jan 20 2021 at 01:35)</a>:</h4>
<p>like on embedded</p>



<a name="223321750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223321750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223321750">(Jan 20 2021 at 01:37)</a>:</h4>
<p>Yeah, here's the reduced gist: <a href="https://gist.github.com/rust-play/6c8dd8bbaf9403887a482b5d5da01ecd">https://gist.github.com/rust-play/6c8dd8bbaf9403887a482b5d5da01ecd</a></p>



<a name="223323877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223323877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223323877">(Jan 20 2021 at 02:10)</a>:</h4>
<p>Hmm</p>



<a name="223323965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223323965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223323965">(Jan 20 2021 at 02:12)</a>:</h4>
<p>That seems fine still</p>



<a name="223323984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223323984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223323984">(Jan 20 2021 at 02:13)</a>:</h4>
<p>Actually that might provide a path forward to emulate</p>



<a name="223324002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223324002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223324002">(Jan 20 2021 at 02:13)</a>:</h4>
<p>I'll have to look into how the various lang items get handled when writing a stable nostd binary</p>



<a name="223324064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223324064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223324064">(Jan 20 2021 at 02:14)</a>:</h4>
<p>I'm assuming we could still handle linking in a default fn for the backtrace hooks in a real impl later, and that the proof of concept can just define a lang items for now</p>



<a name="223324095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223324095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223324095">(Jan 20 2021 at 02:15)</a>:</h4>
<p>you could maybe have a look at the recent-ish default alloc error handler (it's implemented, just currently unstable)</p>



<a name="223343828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223343828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223343828">(Jan 20 2021 at 08:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core/near/223318702">said</a>:</p>
<blockquote>
<p>I think you need nightly to write a no_std <em>binary</em>, though</p>
</blockquote>
<p>that's what the embedded book suggests anyway (if not then can be corrected)</p>



<a name="223380646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223380646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223380646">(Jan 20 2021 at 14:40)</a>:</h4>
<p>Yeah that is incorrect. if the embedded book says that it should be corrected.</p>



<a name="223380992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223380992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223380992">(Jan 20 2021 at 14:43)</a>:</h4>
<p>hmm, not on this page <a href="https://rust-embedded.github.io/book/intro/no-std.html">https://rust-embedded.github.io/book/intro/no-std.html</a></p>



<a name="223393139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223393139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223393139">(Jan 20 2021 at 15:59)</a>:</h4>
<p><a href="https://rust-embedded.github.io/book/start/qemu.html">https://rust-embedded.github.io/book/start/qemu.html</a> I had to search for a while but found it here</p>



<a name="223399430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223399430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223399430">(Jan 20 2021 at 16:40)</a>:</h4>
<p>ah, that page is correct, you've gotta use no_main on stable</p>



<a name="223405232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/223405232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#223405232">(Jan 20 2021 at 17:20)</a>:</h4>
<p>Sorry for confusion then, somehow it stuck with me that I <em>need</em> nightly. Glad to hear it's not the case <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="225248773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248773">(Feb 05 2021 at 01:13)</a>:</h4>
<p>hello again</p>



<a name="225248836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248836">(Feb 05 2021 at 01:14)</a>:</h4>
<p>I'm working on this a bit more rn and currently trying to use lang_items to setup the hooks, basing it off of <code>lang = "panic_impl"</code></p>



<a name="225248845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248845">(Feb 05 2021 at 01:14)</a>:</h4>
<p>and i have no idea how to test this</p>



<a name="225248863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248863">(Feb 05 2021 at 01:14)</a>:</h4>
<p>because my version of core wont compile because of unknown lang items, and I don't know how to get it to build a compiler first and use that</p>



<a name="225248907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248907">(Feb 05 2021 at 01:15)</a>:</h4>
<p>my best guess is <code>--keep-stage</code></p>



<a name="225248913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248913">(Feb 05 2021 at 01:15)</a>:</h4>
<p>and to stagger the work</p>



<a name="225248918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225248918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225248918">(Feb 05 2021 at 01:15)</a>:</h4>
<p>but I don't know how this would then pass CI</p>



<a name="225249116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225249116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225249116">(Feb 05 2021 at 01:18)</a>:</h4>
<p>cfg(stage0) maybe?</p>



<a name="225249226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225249226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225249226">(Feb 05 2021 at 01:20)</a>:</h4>
<p>The compiler changes you made will be present to code/std when <code>cfg(not(stage0))</code></p>



<a name="225250404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/backtrace%20hooks%20in%20core/near/225250404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core.html#225250404">(Feb 05 2021 at 01:36)</a>:</h4>
<p>it's <code>cfg(bootstrap)</code> now, it was changed a while back</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>